<%@page contentType="text/html; charset=UTF-8" %>
<table class="fenye">
    <tr>
        <td>
            共${pageInfo.total}篇文章&nbsp;${pageInfo.pageNum}/${pageInfo.pages}&nbsp;
            <button type="button" id="firstPage">首页</button>
            <c:if test="${pageInfo.hasPreviousPage == true}">
                <button type="button" id="prePage">上一页</button>
            </c:if>
            <c:if test="${pageInfo.hasNextPage == true}">
                <button type="button" id="nextPage">下一页</button>
            </c:if>
            <button type="button" id="lastPage">尾页</button>
            &nbsp;转跳到<input size="2" id="inputPage"/> 页
            <button type="button" id="jumpPage">转跳</button>
        </td>
    </tr>
</table>
<script>
    $(function(){
        $("#firstPage").click(function(){
            jump(${pageInfo.firstPage});
        });
        $("#prePage").click(function(){
            jump(${pageInfo.prePage});
        });
        $("#nextPage").click(function(){
            jump(${pageInfo.nextPage});
        });
        $("#lastPage").click(function(){
            jump(${pageInfo.lastPage});
        });
        $("#jumpPage").click(function () {
            var page = $("#inputPage").val();
            var pattern = /^[0-9]*$/;
            if(pattern.test(page) == false || page == ""){
                alert("请输入正确的页数");
                $("#inputPage").val("");
                return ;
            }
            jump(page);
        });
    });
</script>